export const TOKEN_KEY = "token";
export const USER_KEY = "user";
export const MENU_KEY = "menuList";
export const ROLE_KEY = "roleList";
export const PERMISSION_KEY = "permissionList";

const db = {

  saveObj: (key: string, obj: any) => {
    localStorage.setItem(key, JSON.stringify(obj));
  },
  getObj: (key: string) => {
    const item = localStorage.getItem(key);
    if (!item) {
      return undefined;
    }
    return JSON.parse(item || "");
  },
  save: (key: string, value: string) => {
    localStorage.setItem(key, value);
  },
  get: (key: string) => {
    return localStorage.getItem(key);
  },
  remove: (key: string) => {
    localStorage.removeItem(key);
  }
}

export default db;
